<?php
/**
 * Framework.php is the core of WP Framework which defines the main class
 *
 * @package WP_Framework
 */

/**
 * class WPFramework - Main class loads all includes, adds/removes filters.
 * 
 * @since - 0.1
 */
class WPFramework {
	
	/**
	 * init() - Initialisation method which calls all other methods in turn.
	 *
	 * @since - 0.1
	 */
	function init() {
		$framework = new WPFramework;
		$framework->includes();
		$framework->prep_work();
	}
	
	/**
	 * includes() - Class constructor
	 *
	 * @since - 0.2.1
	 */
	function includes(){
		if ( !defined( 'THEME_LIB' ) )
			define( 'THEME_LIB', TEMPLATEPATH . '/library' );
		require_once( THEME_LIB . '/core/hooks.php' ); // Framework hooks
		require_once( THEME_LIB . '/core/semantic-classes.php' ); // Semantic Classes
		
		if ( file_exists( TEMPLATEPATH . '/assets/theme-functions.php' ) )
			require_once( TEMPLATEPATH . '/assets/theme-functions.php' ); // Require Theme functions if it exist
	}
	
	/**
	 * prep_work() - Class constructor
	 *
	 * @since - 0.2.1
	 */
	function prep_work(){
		/* Remove Generator Link - Credits: (http://www.plaintxt.org) */
		function remove_generator_link() { return ''; }
		add_filter( 'the_generator', 'remove_generator_link', 1 );
	}
} // end of WPFramework;

// Register Widgets ( working on widgets in 0.4 )
if ( function_exists( 'register_sidebars' ) ) {
	register_sidebars( 1, array(
		'before_widget' => '<div id="%1$s" class="widgets %2$s">',
		'after_widget' => '</div>',
		'before_title' => '<h3 class="widgets-title">',
		'after_title' => '</h3>',
	));
}

/* Enable jQuery & load theme.js (props to Esther) */
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'theme_scripts', get_stylesheet_directory_uri() .'/assets/js/screen.js', array( 'jquery' ) ); 

/**
 * wpframework_credits() - Echos credits link
 *
 * @since - 0.1
 * @filter wpframework_credits
 */
function wpframework_credits( $sep = ' &mdash; ' ) {
	$credits = 'Built on <a href="http://wpframework.com">WP Framework</a>'. $sep .'Powered by <a href="http://wordpress.org">WordPress</a>';
	echo apply_filters( 'wpframework_credits', $credits );
}

?>